import pandas as pd

"""
比较结果
"""

inventory = pd.read_csv('inventory.csv')
inventory.drop('update_tm', axis=1, inplace=True)
new_inventory = pd.read_csv('disp_inventory.csv')


def get_genes(se):
    columns = inventory.columns[1:]
    columns = columns[:-1]
    genes = []
    # print(columns)
    for c in columns:
        genes.append(int(se[c]))
    return genes


inventory['old_inventory'] = inventory.apply(get_genes, axis=1)

# 合并结果
df_result = new_inventory.merge(inventory, on='artisan_id')

df_result = df_result[['artisan_id', 'genes', 'inventory', 'old_inventory', 'travel_hour']]

df_result.to_csv('times.csv')
